package s01;

/**
 * @ClassName Role
 * @Description 定义角色类
 * @Author Li
 * @Date 2022/8/2 11:11
 * @ModifyDate 2022/8/2 11:11
 * @Version 1.0
 */
public class Role {
    private int id; // 角色id
    private int blood; // 生命值
    private String name; // 角色名称
    // 添加武器属性
    private Weapon weapon;
    // 添加盔甲属性
    private Armour armour;
    // 添加技能
    private Skill skill;

    public Role() {
    }

    public Role(int id, int blood, String name) {
        this.id = id;
        this.blood = blood;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }

    public Armour getArmour() {
        return armour;
    }

    public void setArmour(Armour armour) {
        this.armour = armour;
    }

    public Skill getSkill() {
        return skill;
    }

    public void setSkill(Skill skill) {
        this.skill = skill;
    }

    // 攻击方法
    public void attack() {
        System.out.println(this.name + "使用" + weapon.getName() + "造成" + weapon.getHurt() + "点伤害");
    }

    // 防御方法
    public void defense() {
        System.out.println(this.name + "穿上" + armour.getName() + "增加" + armour.getProtect() + "点防御");
    }

    // Q技能攻击
    public void useQ() {
        System.out.println("使用Q技能");
        skill.Q();
        System.out.println("攻击结束");
    }
}
